#include <iostream>
#include <algorithm>
#include <vector>

int const maxn = 102;
bool vis[maxn];
int sum[maxn];
int n, k;

std::vector<std::vector<int> > graph;


int dfs(int x)
{
	int n = graph[x].size();
	sum[x] = 0;
	for (int i = 0; i < n; i++) {
		int v = graph[x][i];
		sum[x] += dfs(v) + 1;
	}
	return sum[x];
}

int main()
{
	std::ios::sync_with_stdio(false);
	while (std::cin >> n >> k) {
		graph.clear();
		graph.resize(n);
		std::fill(vis, vis + n, 0);
		std::fill(sum, sum + n, 0);
		for (int i = 0, x, y; i < n-1; i++) {
			std::cin >> x >> y;
			x--; y--;
			graph[x].push_back(y);
		}

		for (int i = 0; i < n; i++)
			if (!vis[i]) sum[i] = dfs(i);
		int ans = 0;
		for (int i = 0; i < n; i++)
			if (sum[i] == k) ans++;
		std::cout << ans << '\n';
	}
}

